package com.example.mystore.servlets.service;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


public class LogoutServlet extends HttpServlet {

    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getSession().removeAttribute("customer");
        req.getSession().removeAttribute("cart");
        req.getSession().removeAttribute("orderMassage");
        req.getSession().removeAttribute("FinalPrice");
        resp.sendRedirect(req.getContextPath()+"/login.jsp");
    }

    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
